Tutorial - #1439
Tutorial#1439
Conversation
|
@par-hermes format |
| @@ -1,4 +1,4 @@ | |||
| .. par_for: | |||
| .. _par_for: | |||
There was a problem hiding this comment.
This was a typo.
| plt.colorbar( | ||
| pm, label=colorbar, fontsize=fontsize, fraction=0.02, pad=0.04, ax=p | ||
| ) | ||
| plt.colorbar(pm, label=colorbar, fraction=0.02, pad=0.04, ax=p) |
There was a problem hiding this comment.
matplotlib api changed. fontsize can't go here anymore.
|
Tutorial live here: https://parthenon-hpc-lab.github.io/parthenon/jmm/turorial/src/tutorial.html |
|
@pgrete @c-prather please re-review. It should be updated with your suggestions and the issues we found in the live run. |
c-prather
left a comment
There was a problem hiding this comment.
Left the changes I had to (one I wanted to) make when updating the compile-able example, and some wording things when going through the text again.
Otherwise LGTM, really excellent stuff and I'm glad we finally have this. Bravo.
Co-authored-by: Cora Prather <cprather@radimant.org>
Co-authored-by: Cora Prather <cprather@radimant.org>
Co-authored-by: Cora Prather <cprather@radimant.org>
Co-authored-by: Cora Prather <cprather@radimant.org>
Co-authored-by: Cora Prather <cprather@radimant.org>
… into jmm/turorial
|
@pgrete is something wrong with the CI machine? Jobs are failing when trying to fetch openpmd from github. |
CI machine was restarted and I had to manually fire up the runners again. |
pgrete
left a comment
There was a problem hiding this comment.
Thanks! Great writeup! This was truly overdue and my impression is that it was well received during the user meeting.
| mkdir src | ||
| touch CMakeLists.txt | ||
| git submodule add git@github.com:parthenon-hpc-lab/parthenon.git external/parthenon | ||
| git add external parthenon |
There was a problem hiding this comment.
| git add external parthenon | |
| git add external/parthenon |
| Parthenon also has a Spack package (``spackage``). You can see | ||
| details in our :ref:`build doc <building>`. |
There was a problem hiding this comment.
ugh, this reminds me that I should update the spack package..
probably even more relevant now given that RIOT is available
| project(ellipse LANGUAGES C CXX) | ||
| # We require C++20 | ||
| set(CMAKE_CXX_STANDARD 20) | ||
| # A useful command for debugging |
There was a problem hiding this comment.
| # A useful command for debugging | |
| # A useful command for debugging as it creates a `compile_commands.json` in your build | |
| # directory containing the exact commands to build the code with a given config. | |
| # Moreover, that file can also be parsed by IDEs for cross referencing. |
| Anatomy of a Task | ||
| ^^^^^^^^^^^^^^^^^^^ |
There was a problem hiding this comment.
| Anatomy of a Task | |
| ^^^^^^^^^^^^^^^^^^^ | |
| Anatomy of a Task | |
| ^^^^^^^^^^^^^^^^^ |
| const Real r = std::sqrt(x * x + y * y); | ||
| const Real th = std::atan2(y, x); |
There was a problem hiding this comment.
| const Real r = std::sqrt(x * x + y * y); | |
| const Real th = std::atan2(y, x); | |
| const Real r = Kokkos::sqrt(x * x + y * y); | |
| const Real th = Kokkos::atan2(y, x); |
| const Real dx = std::min(std::abs(x - xmin), std::abs(xmax - x)); | ||
| const Real dy = std::min(std::abs(y - ymin), std::abs(ymax - y)); |
There was a problem hiding this comment.
| const Real dx = std::min(std::abs(x - xmin), std::abs(xmax - x)); | |
| const Real dy = std::min(std::abs(y - ymin), std::abs(ymax - y)); | |
| const Real dx = Kokkos::min(std::abs(x - xmin), Kokkos::abs(xmax - x)); | |
| const Real dy = Kokkos::min(std::abs(y - ymin), Kokkos::abs(ymax - y)); |
| // speed times dt, which is r * omega * dt, which must be | ||
| // less than delta: | ||
| // dt <= delta / (r * omega) | ||
| ldt = std::min(ldt, delta / (std::abs(r * omega) + EPS)); |
There was a problem hiding this comment.
| ldt = std::min(ldt, delta / (std::abs(r * omega) + EPS)); | |
| ldt = Kokkos::min(ldt, delta / (Kokkos::abs(r * omega) + EPS)); |
| This is very much a toy heuristic for a toy problem. We simply check | ||
| how far away a particle is from the boundaries of its meshblock | ||
| (including ghost cells) and don't let the particle move fast enough to | ||
| leave its current block. |
There was a problem hiding this comment.
| leave its current block. | |
| leave its current block. | |
| Note the use of Kokkos math functions. While not strictly necessary | |
| (`std::` math work just fine on most architectures) using the Kokkos | |
| version ensures portability for future architectures. |
| const IndexRange ib = cellbounds.GetBoundsI(IndexDomain::interior); | ||
| const IndexRange jb = cellbounds.GetBoundsJ(IndexDomain::interior); | ||
| const IndexRange kb = cellbounds.GetBoundsK(IndexDomain::interior); |
There was a problem hiding this comment.
Rotate went over entire, which I assumed to be done because there's no ghost comm.
Is is then fine/consistent to just seed interior?
Probably yes, because on init we communicate Independent no matter what, don't we?
There was a problem hiding this comment.
We do. But I think you're right it's a little confusing. I'll change it to entire.
| After the particle positions have been updated, they must be | ||
| communicated across the mesh, which is the role of the next set of tasks: |
There was a problem hiding this comment.
| After the particle positions have been updated, they must be | |
| communicated across the mesh, which is the role of the next set of tasks: | |
| After the particle positions have been updated, the particles now residing in ghost zones must be | |
| communicated to their respective neighboring blocks, which is the role of the next set of tasks: |
PR Summary
In preparation for the Parthenon workshops coming up I finally sat down and wrote a tutorial for how to use parthenon. In the end I did not use gen AI as I wanted to convey very specifically the story I wanted to convey. I also made some minor tweaks to Parthenon guts and scripts to make sure the tutorial worked as intended.
I can't include the project I wrote that the tutorial walks through, as it would be a bit recursive. But if someone else wanted to create it in the parthenon namespace and follow the tutorial so we had a complete version, that wouldn't be unwelcome. That would be a good test my instructions work for someone else.
PR Checklist